package cn.acewill.yxd.yunxundian.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import java.util.ArrayList;
import cn.acewill.yxd.yunxundian.R;
import cn.acewill.yxd.yunxundian.model.EvaluteBean;

/**
 * Created by AAA on 2017/4/10.
 */

public class CommonProblemAdapter extends BaseAdapter{

    private Context context;
    private ArrayList<EvaluteBean> list;


    public CommonProblemAdapter(Context context,ArrayList<EvaluteBean> list){
        this.context=context;
        this.list=list;
    }
    @Override
    public int getCount() {
        return list==null?0:list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if(convertView==null){
            convertView= LayoutInflater.from(context).inflate(R.layout.common_problem,parent,false);
            holder=new ViewHolder();
            holder.textContent= (TextView) convertView.findViewById(R.id.textContent);
            holder.result= (TextView) convertView.findViewById(R.id.result);
            holder.threeScore= (TextView) convertView.findViewById(R.id.threeScore);
            holder.twoScore= (TextView) convertView.findViewById(R.id.twoScore);
            holder.oneScore= (TextView) convertView.findViewById(R.id.oneScore);
            convertView.setTag(holder);
        }else{
            holder= (ViewHolder) convertView.getTag();
        }
        EvaluteBean bean=list.get(position);
        //String standard=bean.getEvaStandard();
        //holder.textContent.setText(standard+"\t\t"+bean.getEvaDate1());
        holder.result.setText("合格");
        holder.threeScore.setText("3");
        holder.twoScore.setText("2");
        holder.oneScore.setText("1");
        holder.threeScore.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        holder.twoScore.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        holder.oneScore.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        return convertView;
    }

    class ViewHolder{
        TextView textContent;
        TextView result;
        TextView threeScore;
        TextView twoScore;
        TextView oneScore;

    }

}
